package com.fyl.pattern.factory.before;

/**
 * 咖啡商店
 */
public class CoffeeStore {

    public Coffee orderCoffee(String type){
        Coffee coffee = null;
        if("americian".equals(type)){
            coffee = new AmericanCoffee();
        }else if("latte".equals(type)){
            coffee = new LatteCoffee();
        }else {
            throw new RuntimeException("对不起，您点的咖啡没有了");
        }
        //加配料
        coffee.addMilk();
        coffee.addSugar();
        return coffee;
    }
}
